package com.baseweb.webadmin.core.model.mapper;

import com.baseweb.webadmin.core.model.pojo.ByNotice;
import com.baseweb.webadmin.core.model.pojo.ByNoticeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ByNoticeMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    int countByExample(ByNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    int deleteByExample(ByNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    @Delete({
        "delete from by_notice",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    @Insert({
        "insert into by_notice (user_id, notice_type, ",
        "img_url, name, descn, ",
        "status, create_time, ",
        "update_time, ",
        "view_count, sort)",
        "values (#{userId,jdbcType=INTEGER}, #{noticeType,jdbcType=INTEGER}, ",
        "#{imgUrl,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{descn,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{viewCount,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(ByNotice record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    int insertSelective(ByNotice record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    List<ByNotice> selectByExample(ByNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    @Select({
        "select",
        "id, user_id, notice_type, img_url, name, descn, status, create_time, update_time, ",
        "view_count, sort",
        "from by_notice",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ByNotice selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    int updateByExampleSelective(@Param("record") ByNotice record, @Param("example") ByNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    int updateByExample(@Param("record") ByNotice record, @Param("example") ByNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    int updateByPrimaryKeySelective(ByNotice record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_notice
     *
     * @mbggenerated Mon Feb 06 01:05:25 CST 2017
     */
    @Update({
        "update by_notice",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "notice_type = #{noticeType,jdbcType=INTEGER},",
          "img_url = #{imgUrl,jdbcType=VARCHAR},",
          "name = #{name,jdbcType=VARCHAR},",
          "descn = #{descn,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "view_count = #{viewCount,jdbcType=INTEGER},",
          "sort = #{sort,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ByNotice record);
}